import React from 'react';
import {
    BrowserRouter as Router,
    Route,
    Switch
} from "react-router-dom";
import AuthRoute from './components/AuthRoute';
import Home from './pages/Home';
import Login from './pages/Login';
import Collect from './pages/Collect';
import AppProvider from './Appcontext';
import PartProvider from './PartContext';

const App = ()=>{
    return (
        <Router>
            <AppProvider>
                <Switch>
                    <Route path='/login' component={Login}/>
                    <PartProvider>
                        <AuthRoute path='/collect' component={Collect}/>
                        <AuthRoute exact path='/' component={Home}/> 
                    </PartProvider>
                    <Route component={()=><h1>404</h1>}/>
                </Switch>
            </AppProvider>
        </Router>
    )
}

export default App;


